home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue37 / D4Bugs / TestLBU.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1998-07-24  |  802 b   |  43 lines

  1. unit TestLBU;
  2.  
  3. // Remove period to fix the TCustomList.ItemIndex bug
  4. {.$DEFINE FIX_BUG}
  5.  
  6. interface
  7.  
  8. uses
  9. {$IFDEF FIX_BUG}
  10.   FixupLB,
  11. {$ENDIF}
  12.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  13.   StdCtrls;
  14.  
  15. type
  16.   TTestLBForm = class(TForm)
  17.     ListBox1: TListBox;
  18.     Test: TButton;
  19.     procedure TestClick(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25.  
  26. var
  27.   TestLBForm: TTestLBForm;
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TTestLBForm.TestClick(Sender: TObject);
  34. begin
  35.   ListBox1.MultiSelect := false;
  36.   ListBox1.ItemIndex := -1;
  37.   if ListBox1.ItemIndex >= 0
  38.   then ShowMessage('TCustomList.ItemIndex is buggy!')
  39.   else ShowMessage('TCustomList.ItemIndex is fixed!');
  40. end;
  41.  
  42. end.
  43.